trigger setLookupAtNewBorn on NewBornNumber__c (before update,before insert) {
        list<id> idl=new list<id>();
        list<achieve__c> achl=new list<achieve__c>();
        list<achieve__c> a=new list<achieve__c>();
        
        for(NewBornNumber__c nbnt:trigger.new){
            idl.add(nbnt.Hospital__c);
        }
        
        achl=[select id,year__c,month__c,hospital_name__c from achieve__c where hospital_name__c in:idl];
        
        for(NewBornNumber__c nbn:trigger.new){
            for(achieve__c ach:achl){
            
                if(ach.hospital_name__c==nbn.hospital__c && string.valueof(ach.month__c) == string.valueof(nbn.month__c) && string.valueof(ach.year__c)==string.valueof(nbn.year__c)){
                    ach.NewBornNumber__c=nbn.id;
                    a.add(ach);
                    
                }
            }
        }
        update a;

}